﻿@using DNA.OpenAPI.Atom;
@model IEnumerable<AtomEntry>
<ul class="ui-helper-reset" style="padding: 10px;">
    @foreach (var item in Model)
    {
        <li>
            <table>
                <tr>
                    <td>
                        @if (item.Links != null)
                        {
                            var imgLink = item.Links.Where(l => l.Type.StartsWith("image")).FirstOrDefault();

                            if (!string.IsNullOrEmpty(imgLink.NavigateUrl))
                            {
                            <div class="d-avatar">
                                <img src="@imgLink.NavigateUrl" alt="@imgLink.Text" />
                            </div>
                            }
                        }
                    </td>
                    <td style="vertical-align: top; padding: 5px;">
                        <h3 class="d-post-title">
                            <a href="@item.ID" title="@item.Title" target="_blank" rel="nofollow">@Html.Cut(item.Title, (int)ViewData["TextLen"])</a>
                        </h3>
                        <p class="d-post-summary" title="@item.Summary" style="margin:0px;">
                            @if (!string.IsNullOrEmpty(item.Summary))
                            {
                                @Html.Cut(TextEngine.Text(item.Summary), 255)
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(item.Content.Text))
                                {
                                @Html.Cut(TextEngine.Text(item.Content.Text), 255)
                                }
                            }
                        </p>
                        <ul class="d-horizontal-list">
                            @if ((bool)ViewData["ShowAuthor"] && !string.IsNullOrEmpty(item.Author.Name))
                            {  
                                <li style="color: #cccccc; font-style: italic">@Html.Global("RES_POSTBY") <a href="@(string.IsNullOrEmpty(item.Author.Uri) ? "javascript:void(0);" : item.Author.Uri)" rel="nofollow" target="_blank">@item.Author.Name</a>
                                </li>
                            }
                            @if ((bool)ViewData["ShowDate"])
                            { 
                                <li style="color: #cccccc; font-style: italic">
                                    @Html.Global(item.Published)
                                </li>
                            }
                            @if ((item.Categories != null) && (item.Categories.Count > 0))
                            {
                                foreach (var c in item.Categories)
                                {
                                <li><a href="@(string.IsNullOrEmpty(c.Scheme) ? "javascript:void(0);" : c.Scheme)">@(string.IsNullOrEmpty(c.Text) ? c.Term : c.Text)</a></li>
                                }
                            }
                        </ul>
                    </td>
                </tr>
            </table>
        </li>   
    }
</ul>
